class HomeController < ApplicationController
  filter_access_to :all 
 
  def index
    
    @random_artist = Artist.random(1).first
    @random_review = Review.random(1).first
    @recent_edits = Edit.find(:all, :order => "id desc", :limit => 5)
    @new_releases = Array.new #= Edition.all(:conditions => ["month = ? AND year = ?", Time.now.month, Time.now.year], :limit => 5)
    @born_today = Array.new #= Artist.all(:conditions => ["formdate_day = ? AND 
                #                              formdate_month = ? AND
                #                              is_group = false", 
                #                              Time.now.day, Time.now.month ],
                #             :limit => 5)
    @artist_count = Artist.count
    @release_count = Edition.count
    @song_count = Song.count
    
  end

  def random
    model = rand(5)
    if model == 0
      artist = Artist.random(1).first
      redirect_to artist_path(artist)
    elsif model == 1
      release = Release.random(1).first
      redirect_to release_edition_path(release, release.editions.first)
   elsif model == 2
     song = Song.random(1).first
     redirect_to song_path(song)
   elsif model == 3
     label = Label.random(1).first
     redirect_to label_path(label)
   elsif model == 4
     genre = Genre.random(1).first
     redirect_to genre_path(genre)
   end
  end

end
